<?php

$user_id = $GLOBALS['user_id'];
$uid = $GLOBALS['uid'];

$user = new user($user_id);
$user_info[$user_id] = $user->load_tables('user_settings,user_stats,user_gladiator');

//echo government_setting('treasury_name');

// echo '<pre>';
// echo var_dump($user_info);
// echo '</pre>';

require($config['dir_inc'] . 'recaptcha.inc.php');

switch ($_REQUEST['function'])
{
    case 'get':
                    echo 'effort building for <b>'.  $user_info[$user_id]['username'] . '</b>.<BR>';
                    $PHP_SELF = $_SERVER['REQUEST_URI'];
                    echo "<form action=\"$PHP_SELF\" name=\"recaptcha\" method=\"post\">";
                    // could add in roman numeral converter here if wanted
                            
                            
                            
                            # the response from reCAPTCHA
                            $resp = null;
                            # the error code from reCAPTCHA, if any
                            $error = null;
                            
                            # are we submitting the page?
                            if (@$_POST["submit"]) {
                              $resp = recaptcha_check_answer ($privatekey,
                                                              $_SERVER["REMOTE_ADDR"],
                                                              $_POST["recaptcha_challenge_field"],
                                                              $_POST["recaptcha_response_field"]);
                            
                              if ($resp->is_valid) {
											echo "<pre>Effort Gained! <br>-- <br>+ $effort energy stored</pre>";
                              } else {
                                # set the error code so that we can display it. You could also use
                                # die ("reCAPTCHA failed"), but using the error message is
                                # more user friendly
                                $error = $resp->error;
											echo "<pre><font color=red>No Luck!</font> <br>-- <br>no energy gained</pre>";
                              }
                            }
                            echo recaptcha_get_html($GLOBALS['publickey'], $error);
                           // echo '<input type=hidden name="uid" value="'.$uid.'">';
                            ?>
                                <br/>
                                <input type="submit" name="submit" value="submit" />
                                </form>
        <?php
    break;
    default:
    
}


?>